package ServerTest;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

import parameters.Vec2f;

public class Server implements Runnable {
	
	private Socket connection;
	private int ID;
	
	Server(Socket s, int i) {
		this.connection = s;
		this.ID = i;
	}
	
	@Override
	public void run() {
		System.out.println("[i] Client with ID: " + this.ID + " connected!");	
		
	}
	
	public static void main(String[] args) {
		int port = 1337;
		int count = 0;

		try {
			ServerSocket socket = new ServerSocket(port);
			System.out.println("[i] ServerSocket initialized!");
			
			while (count < 2) {
				System.out.println("[i] Server is waiting for incuming connection!");
				
				Socket connection = socket.accept();
				Runnable runnable = new Server(connection, count++);
				Thread thread = new Thread(runnable);
				thread.start();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}

}